package puj.promobil.prometer;

import puj.promobil.prometer.fragmento.ProductoDetalle;
import android.os.Bundle;
import android.app.Activity;
import android.content.res.Configuration;
import android.view.Menu;

public class ActivityDetalleProductoSingle extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		// Need to check if Activity has been switched to landscape mode
		// If yes, finished and go back to the start Activity
		if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
			finish();
			return;
		}
		setContentView(R.layout.activity_detalle_producto);
		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			int id = extras.getInt("id");
			ProductoDetalle fragment = (ProductoDetalle) getFragmentManager()
					.findFragmentById(R.id.detailFragment2);
			if (fragment != null && fragment.isInLayout()) {
				fragment.cargarDetalle(id);
			}

		}
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(
				R.menu.activity_activity_detalle_producto_single, menu);
		return true;
	}
}
